<?php
/*
 * Smarty plugin
 * --------------------------------------------------------------------------------
 * File:     function.getPathName.php
 * Type:     function
 * Name:     getPathName
 * Purpose:  resolve paths to client-side files 
 * -------------------------------------------------------------------------------- 
 */
function smarty_function_getPathName($params, $smarty){
  $path = 'templates/'.TEMPLATE.'/'.$params['file'];
  $fallback = 'templates/basic/'.$params['file'];
  $absPath = $siteroot.$path;
  if (file_exists($absPath)){
    return $path;
  } else {
    return $fallback;
  }
}

?>
